# 输入一个 rendered 填充此组与下一组之间的节点

# say [fork] exception handle called

# 相减
scoreboard players set fork_rendered mt_index 3
scoreboard players operation fork_rendered mt_index *= rendered mt_index

scoreboard players operation @e[tag=mt_gen_last] mt_index -= rendered mt_index
scoreboard players operation @e[tag=mt_gen] mt_index -= fork_rendered mt_index

# 打上花火(?)
tag @e[scores={mt_index=0},tag=mt_gen_last,limit=1] add mt_surf_fill_in1
tag @e[scores={mt_index=2},tag=mt_gen,limit=1] add mt_surf_fill_in2

scoreboard players operation @e[tag=mt_gen_last] mt_index += rendered mt_index
tag @e[scores={mt_index=0},tag=mt_gen_last,limit=1] add mt_surf_fill_in3
scoreboard players operation @e[tag=mt_gen_last] mt_index -= rendered mt_index
function mountain:surf_fill/entry
tag @e[tag=mt_surf_fill_in3] remove mt_surf_fill_in3
tag @e[tag=mt_surf_fill_in1] remove mt_surf_fill_in1
tag @e[tag=mt_surf_fill_in2] remove mt_surf_fill_in2

tag @e[scores={mt_index=2},tag=mt_gen,limit=1] add mt_surf_fill_in1
scoreboard players operation @e[tag=mt_gen_last] mt_index += rendered mt_index
scoreboard players operation @e[tag=mt_gen] mt_index += fork_rendered mt_index
tag @e[scores={mt_index=0},tag=mt_gen_last,limit=1] add mt_surf_fill_in2
tag @e[scores={mt_index=0},tag=mt_gen,limit=1] add mt_surf_fill_in3
scoreboard players operation @e[tag=mt_gen_last] mt_index -= rendered mt_index
scoreboard players operation @e[tag=mt_gen] mt_index -= fork_rendered mt_index
function mountain:surf_fill/entry
tag @e[tag=mt_surf_fill_in3] remove mt_surf_fill_in3
tag @e[tag=mt_surf_fill_in1] remove mt_surf_fill_in1
tag @e[tag=mt_surf_fill_in2] remove mt_surf_fill_in2

scoreboard players operation @e[tag=mt_gen_last] mt_index += rendered mt_index
scoreboard players operation @e[tag=mt_gen] mt_index += fork_rendered mt_index

schedule function mountain:gen/fork/complete 1s